// pages/personal/personal.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    titleArrow: "../../pics/arrow.png",
    lineItems:
      [
        { id: 1, name: '我的预约' },
        { id: 2, name: '发布订单' },
        { id: 3, name: '关于我们' },
      ],

    userName: '',

  },
  lineClicked: function (e) {
    console.log(e);
    console.log(e.currentTarget.id);
    var curId = e.currentTarget.id;
    if (curId == 1) {
      console.log("Jump to Orders");
      this.navigateToPage('orders');
    }
    else if (curId == 2) {
      console.log("Switch to AddMyCar");
      this.navigateToPage('addMyCar');


    }
    else if (curId == 3) {
      console.log("About US:Team 10");
      wx:wx.showToast({
        title: '计算机工程学院第十小组',
        icon: 'none',
        duration: 3000,
        mask: true,
      })
    }
  },
  navigateToPage: function (pageName) {
    var pagePathTail = '/pages' + '/' + pageName + '/' + pageName;
    wx.navigateTo({
      url: pagePathTail,
      fail: function (res) {
        console.log("NavigateToPage Fail");
      },
    })

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var globalUserName = getApp().globalData.userName;
    console.log("GName:" + globalUserName);
    this.setData(
      {
        userName: globalUserName
      }
    )
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})